package com.ruoyi.web.controller.system;

import java.util.List;

import com.ruoyi.common.core.domain.entity.SysjurInit;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.ISysjurInitService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 系统初始化Controller
 * 
 * @author ess
 * @date 2021-10-18
 */
@RestController
@RequestMapping("/system/sysJurInit")
public class SysjurInitController extends BaseController
{
    @Autowired
    private ISysjurInitService sysjurInitService;

    /**
     * 查询系统初始化列表
     */
    @PreAuthorize("@ss.hasPermi('system:sysJurInit:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysjurInit sysjurInit)
    {
        startPage();
        List<SysjurInit> list = sysjurInitService.selectSysjurInitList(sysjurInit);
        return getDataTable(list);
    }

    /**
     * 导出系统初始化列表
     */
    @PreAuthorize("@ss.hasPermi('system:sysJurInit:export')")
    @Log(title = "系统初始化", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(SysjurInit sysjurInit)
    {
        List<SysjurInit> list = sysjurInitService.selectSysjurInitList(sysjurInit);
        ExcelUtil<SysjurInit> util = new ExcelUtil<SysjurInit>(SysjurInit.class);
        return util.exportExcel(list, "系统初始化数据");
    }

    /**
     * 获取系统初始化详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:sysJurInit:query')")
    @GetMapping(value = "/{jurInitId}")
    public AjaxResult getInfo(@PathVariable("jurInitId") String jurInitId)
    {
        return AjaxResult.success(sysjurInitService.selectSysjurInitByJurInitId(jurInitId));
    }

    /**
     * 新增系统初始化
     */
    @PreAuthorize("@ss.hasPermi('system:sysJurInit:add')")
    @Log(title = "系统初始化", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysjurInit sysjurInit)
    {
        return toAjax(sysjurInitService.insertSysjurInit(sysjurInit));
    }

    /**
     * 修改系统初始化
     */
    @PreAuthorize("@ss.hasPermi('system:sysJurInit:edit')")
    @Log(title = "系统初始化", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysjurInit sysjurInit)
    {
        return toAjax(sysjurInitService.updateSysjurInit(sysjurInit));
    }

    /**
     * 删除系统初始化
     */
    @PreAuthorize("@ss.hasPermi('system:sysJurInit:remove')")
    @Log(title = "系统初始化", businessType = BusinessType.DELETE)
	@DeleteMapping("/{jurInitIds}")
    public AjaxResult remove(@PathVariable String[] jurInitIds)
    {
        return toAjax(sysjurInitService.deleteSysjurInitByJurInitIds(jurInitIds));
    }
}
